class Solution:
    def findJudge(self, n: int, trust) -> int:
        d, e = dict(), dict()
        for t in trust:
            d[t[0]] = d.get(t[0], 0) + 1
            e[t[1]] = e.get(t[1], 0) + 1
        for k,v in e.items():
            if v == n-1 and k not in d:
                return k
        else:
            return -1


if __name__ == '__main__':
    c = Solution()
    n =     3
    trust = [[1,3],[2,3]]
    print(c.findJudge(n, trust))